<?php 
include('conexion.php');
$itemcodmovreg=$_POST['itemcodmovreg'];

$sqldelemrp="select * FROM detallemovimiento WHERE itemmov='$itemcodmovreg'"; 
$resultt=mysql_query($sqldelemrp,$conn) or die(mysql_error());
$rowmmvv=mysql_fetch_array($resultt);

$sqlsede2 =mysql_query("SELECT * FROM sedesregistrales",$conn) or die(mysql_error());
$sqlsec2 =mysql_query("SELECT * FROM seccionesregistrales",$conn) or die(mysql_error());
$sqltra2 =mysql_query("SELECT * FROM tipotramogestion",$conn) or die(mysql_error());
$sqlestra2=mysql_query("SELECT * FROM estadoregistral",$conn) or die(mysql_error());
$coduser2=$rowmmvv['encargado'];
$sqluser2=mysql_query("SELECT * FROM usuarios where idusuario='$coduser2'",$conn) or die(mysql_error());
$rowwuser2=mysql_fetch_array($sqluser2);

?>


<table width="631" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="14" class="camposss">&nbsp;</td>
    <td width="71" height="30" class="camposss">Fecha</td>
    <td width="213" height="30" class="camposss"><label>
      <input name="fechamov2" type="text"  class="tcal" size="20" style="background:#FFFFFF" value="<?php echo $rowmmvv['fechamov']; ?>" onclick="aumenta2();" onChange="aumenta2();" readonly="readonly" onblur="aumenta2();" onmouseout="aumenta2();" onkeyup="aumenta2();" onmouseover="aumenta2();" />
    </label></td>
    <td width="97" height="30" class="camposss">Vencimiento</td>
    <td width="236" height="30">
      <input name="vencimiento2" type="text" value="<?php echo $rowmmvv['vencimiento']; ?>" id="vencimiento2"  readonly="readonly" class="tcal" size="20" style="background:#FFFFFF" />
    </td>
  </tr>
  <tr>
    <td class="camposss">&nbsp;</td>
    <td height="30" class="camposss">Oficina Registral</td>
    <td height="30" class="camposss"><select name="idsedereg2" id="idsedereg2">
      
      <?php
	     $sqlsede3 =mysql_query("SELECT * FROM sedesregistrales where idsedereg='".$rowmmvv['idsedereg']."'",$conn) or die(mysql_error());
		// mysql_query("SET NAMES utf8");
		 $rowsede3 = mysql_fetch_array($sqlsede3);
		 if($rowsede3['idsedereg']==''){
			 echo "<option value='' selected='selected'>Seleccionar</option>";
			 }else{echo "<option value='".$rowsede3['idsedereg']."' selected='selected'>".$rowsede3['dessede']."</option>";}
	      
	  
	       while($rowsede2 = mysql_fetch_array($sqlsede2)){
	         echo "<option value=".$rowsede2['idsedereg'].">".$rowsede2['dessede']."</option> \n";
             }
	     ?>
    </select></td>
    <td height="30" class="camposss">Tramite</td>
    <td height="30"><select name="idtiptraoges2" id="idtiptraoges2">
      <?php
	      $sqltra3 =mysql_query("SELECT * FROM tipotramogestion where idtiptraoges='".$rowmmvv['idtiptraoges']."'",$conn) or die(mysql_error());
	      $rowstra3 = mysql_fetch_array($sqltra3);
		  
		  if($rowstra3['idtiptraoges']==''){
			 echo "<option value='' selectec='selected'>Seleccionar</option>";
			 }else{  echo "<option value=".$rowstra3['idtiptraoges']." selected='selected'>".$rowstra3['desctiptraoges']."</option> ";}
		
	  
	       while($rowstra2 = mysql_fetch_array($sqltra2)){
	         echo "<option value=".$rowstra2['idtiptraoges'].">".$rowstra2['desctiptraoges']."</option> \n";
             }
	     ?>
    </select></td>
  </tr>
  <tr>
    <td class="camposss">&nbsp;</td>
    <td height="30" class="camposss">Secci&oacute;n Registro</td>
    <td height="30" class="camposss"><select name="idsecreg2" id="idsecreg2">
      <?php
	      $sqlsec3 =mysql_query("SELECT * FROM seccionesregistrales where idsecreg='".$rowmmvv['idsecreg']."'",$conn) or die(mysql_error());
	      $rowsec3 = mysql_fetch_array($sqlsec3);
		  
		  if($rowsec3['idsecreg']==''){
			 echo "<option value='' selectec='selected'>Seleccionar</option>";
			 }else{ echo "<option value=".$rowsec3['idsecreg']." selectec='selected'>".$rowsec3['dessecc']."</option>";}
		  
		 
		  
	       while($rowsec2 = mysql_fetch_array($sqlsec2)){
	         echo "<option value=".$rowsec2['idsecreg'].">".$rowsec2['dessecc']."</option> \n";
             }
	     ?>
    </select></td>
    <td height="30" class="camposss">Importe</td>
    <td height="30"><input name="importee2" type="text" id="importee2" value="<?php echo $rowmmvv['importee']; ?>" size="15" style="background:#FFFFFF;" />
        <input name="conestado2" type="hidden" id="conestado2" value="<?php echo $rowmmvv['idestreg']; ?>" size="4" onkeyup="return validacion(this.value)" /></td>
  </tr>
  <tr>
    <td class="camposss">&nbsp;</td>
    <td height="30" class="camposss">Titulo en RR.PP</td>
    <td height="30" class="camposss"><label>
      <input name="titulorp2" type="text" id="titulorp2" value="<?php echo $rowmmvv['titulorp']; ?>" size="25" style="background:#FFFFFF" />
    </label></td>
    <td height="30" class="camposss">Observacion</td>
    <td height="30" rowspan="2"><label>
      <textarea name="observa2" style="background:#FFFFFF; text-transform:uppercase;" id="observa2" cols="30" rows="3"><?php echo $rowmmvv['observa']; ?></textarea>
    </label></td>
  </tr>
  <tr>
    <td class="camposss">&nbsp;</td>
    <td height="30" class="camposss">Estado</td>
    <td height="30" class="camposss"><select name="idestreg2" id="idestreg2" onchange="estadorrpp2(this.value)">
      <?php
	      $sqlestra3=mysql_query("SELECT * FROM estadoregistral where idestreg='".$rowmmvv['idestreg']."' ",$conn) or die(mysql_error());
	      $rowestreg3 = mysql_fetch_array($sqlestra3);
		  
		  if($rowestreg3['idestreg']==''){
			 echo "<option value='' selectec='selected'>Seleccionar</option>";
			 }else{ echo "<option value=".$rowestreg3['idestreg']." selected='selected'>".$rowestreg3['desestreg']."</option> \n";}
		
		  
	       while($rowestreg2 = mysql_fetch_array($sqlestra2)){
	         echo "<option value=".$rowestreg2['idestreg'].">".$rowestreg2['desestreg']."</option> \n";
             }
	     ?>
    </select>
    <input name="codusuario2" value="<?php echo $coduser2; ?>" type="hidden" id="codusuario2" size="5" /></td>
    <td height="30" class="camposss">&nbsp;</td>
  </tr>
  <tr>
    <td class="camposss">&nbsp;</td>
    <td height="30" class="camposss">Encargado</td>
    <td height="30" class="camposss"><label>
      <input type="text" style="background:#FFFFFF" readonly="readonly" name="encargado2" value="<?php 
	  

	  echo $rowwuser2["prinom"]." ".$rowwuser2["segnom"]." ".$rowwuser2["apepat"]." ".$rowwuser2["apemat"];
	   ?>" id="encargado2" />
    </label></td>
    <td height="30" colspan="2" class="camposss"><?php 
if ($rowmmvv['numeroo']!=""){
echo "<div id='ntitulo2' style='display:; width:300px'>
  <table width='297' border='0' cellspacing='0' cellpadding='0'>
    <tr>
      <td width='98'>N&deg; de Partida</td>
      <td width='199'><label>
        <input type='text' name='numeroo2' style='background:#FFFFFF' value='".$rowmmvv['numeroo']."' id='numeroo2' />
      </label></td>
    </tr>
  </table>
</div>";
}else{
	
	echo " <input type='hidden' name='numeroo2' style='background:#FFFFFF' value='' id='numeroo2' />";
	}
?></td>
  </tr>
  <tr>
    <td class="camposss">&nbsp;</td>
    <td height="30" class="camposss">Anotaci&oacute;n</td>
    <td height="30" colspan="3" class="camposss"><table width="484" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="387"><input name="anotacion2" type="text" id="anotacion2" value="<?php echo $rowmmvv['anotacion']; ?>" size="60" style="background:#FFFFFF; text-transform:uppercase;" /></td>
        <td width="137"><a href="#" onclick="validaeditmovreg()"><img src="iconos/grabar.png" width="94" height="29" border="0" /></a></td>
      </tr>
    </table>       </td>
  </tr>
</table>
